package com.luli;

import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.connector.Connector;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;

import com.luli.service.impl.ESMappingImpl;

import java.util.ArrayList;

@SpringBootApplication
@MapperScan(basePackages = {"com.luli.dao"})
public class LuliEsApiApplication {

    private static final Logger log = LoggerFactory.getLogger(ESMappingImpl.class);

    public static void main(String[] args) {
        SpringApplication.run(LuliEsApiApplication.class, args);
        log.info("==========================");
        log.info("访问地址IP后需要加后缀：" + "LuLi");
        log.info("==========================");
    }

    //特殊字段处理
    @Bean
    public TomcatServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.addConnectorCustomizers((Connector connector) -> {
            connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
            connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
        });
        return factory;
    }


}
